<?php
defined('TWCMS_PATH') or exit;

$cfg = $this->runtime->xget();

$store = R('store');

$updir = 'upload/'.$store.'/';

$config = array(
    'maxSize' => $cfg['up_img_max_size'],
    'allowExt' => $cfg['up_img_ext'],
    'upDir' => TWCMS_PATH . $updir,
);

$up = new upload($config, 'upfile');
$info = $up->getFileInfo();
$path = $updir . $info['path'];
if ($info['state'] == 'SUCCESS') {
    echo '<script>parent.setDisplay("' . $path . '");</script>';
}
exit;